package org.xliu.cs.openproject.codegenerator.restapi;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;
import java.util.List;

/**
 * 参数信息
 */
public class ParameterInfo {
    @JsonProperty("name")
    private String name;
    
    @JsonProperty("in")
    private String in;
    
    @JsonProperty("type")
    private String type;

    public ParameterInfo() {
    }

    public static List<ParameterInfo> fromJsonNodeList(JsonNode parametersNode, ObjectMapper objectMapper) throws IOException {
        // 这个方法暂时保留用于兼容性，后续可以移除
        return objectMapper.convertValue(parametersNode, objectMapper.getTypeFactory().constructCollectionType(List.class, ParameterInfo.class));
    }

    // Getters and setters
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIn() {
        return in;
    }

    public void setIn(String in) {
        this.in = in;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

}